function [backupPathTable] = nodeUseOnce(primaryPathTable, backupPathTable, disp_loc,matrix) 
p = length(primaryPathTable);
  b = length(backupPathTable);
  lastElement = backupPathTable(b);
  p1 = primaryPathTable(1);
  b1 = backupPathTable(1);
  %newBackupPathTable = zeros(1,1); 
  counter = 1;
  counter1 = 0;
  counter2 = 0;
  counter3 = 0;
  n = 0;
  overUseNodes = 0;
  for i = 1:b
      counter2 = counter2 + 1;
      node = backupPathTable(i);
      timesOfUseTheNode = 0;
      for j = 1: b
          node1 = backupPathTable(j);
          if node == node1
              timesOfUseTheNode = timesOfUseTheNode + 1;
              n1 = i;
          end                
      end 
      for j = 1: p
          node1 = primaryPathTable(j);          
          if node == node1
              counter1 = counter1 + 1;              
          end                
      end 
      if counter1 < counter2
            counter1 = 0;
            counter2 = 0;           
      end
      if counter1 == 3
          counter3 = 3;
          n1 = i - 1;
      end
      if timesOfUseTheNode > 1 || counter3 == 3          
          if n ~= node
             overUseNodes(counter, 1) = counter;
             overUseNodes(counter, 2) = timesOfUseTheNode;             
             overUseNodes(counter, 3) = backupPathTable(n1);
             counter = counter + 1;             
          end 
          n = node;
      end    
  end 
if overUseNodes ~= 0        
        numberOfOverUseNodes = length(overUseNodes) / 3;  
        for i = 1:numberOfOverUseNodes
            afterFirstTime = 1;
            if counter3 == 3
               afterFirstTime = 2; 
            end
            node = overUseNodes (i,3);
            nodeTimes = overUseNodes(i,2);
            for j = 1:b
                b1 = backupPathTable(j);
                if b1 == node 
                    if afterFirstTime > 1
                        nodeTimes = nodeTimes - 1;
                        j1 = j - 1;
                        previousNode = backupPathTable(j1);
                        test1 = 0;
                        for d = 1: p
                            if test1 == 0
                                primaryNode = primaryPathTable (d);
                                if primaryNode == previousNode
                                    d1 = d + 2;
                                    nextHop = primaryPathTable(d1);
                                    test1 = 1;
                                end
                            end
                        end
                        [pathBetweenTwoNodes] = anotherBackupPath(backupPathTable, disp_loc, matrix, primaryNode, nextHop, node);
                        [backupPathTable] = insertBackupPathNodes(backupPathTable, pathBetweenTwoNodes, primaryNode, nextHop, node);
                    end
                    afterFirstTime = afterFirstTime + 1;
                end
            end      
        end
    end
end